home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / jam / jamdisk7 / readme.second < prev    next >
Text File  |  1995-03-18  |  6KB  |  198 lines

  1. GNU C for the Amiga
  2. ===================
  3.  
  4. History
  5. -------
  6.  
  7. GNU C (GCC) is a freely-distributable compiler which has been ported
  8. to the Amiga. The present release is 1.37; GCC has moved on to at
  9. least 1.40, but 1.37 seems very reliable. I haven't seen any wrong
  10. code generated yet.
  11.  
  12. The system is very large. You need a hard drive and lots of RAM (I
  13. have a fully populated A590 and 512k clock expansion, making 3 Mb in
  14. all, which is comfortable most of the time).
  15.  
  16. The first time I came across it was when Richard Harrison (tricky@cix)
  17. uploaded it in November 1990. At that time it came with the PDC
  18. Libraries, which were in a far from satisfactory state. Also, the
  19. Assembler GAS outputs Sun-format object files; these had to be
  20. converted to Amiga (BLink) format by a utility SObjA, a process
  21. which was complicated by a particular construct in the object files
  22. that wasn't recognised by BLink.
  23.  
  24. The first task was to get the libraries sorted out. I have tried to
  25. make them as 'standard' as possible; this means that functions in the
  26. Standard C libraries (see, for example, Kernighan & Ritchie, second
  27. edition) do by and large what they should, if they're there at all.
  28. I've included in <system.h> a set of functions which you might call
  29. 'generic UNIX', for which my bible has been SunOS. In general, if the
  30. function's supported, it's in the headers; if not, not.
  31.  
  32. I also had to produce ARP.LIB (the stubs for ARP.LIBRARY); most
  33. compilers, for example Lattice, use `pragmas' so that the compiler
  34. can generate the right code in-line. The nearest to this for GCC is
  35. to use `inline assembler', and you can see a (long) example of this
  36. in the include file <arpfunctions.inline.h>, but it's not always
  37. convenient to include about 100 extra functions in your compilation!
  38.  
  39. The second task was to attempt to eliminate SObjA. Richard supplied
  40. me with the sources for GCC (the GNU front-end), LD (the Linker),
  41. AR (the Librarian) and others. LD had already been partially changed
  42. by Markus Wild and Richard to output Amiga executables, but there
  43. was a fair bit of tweaking still to do. I also had to generate the
  44. equivalent of ARP.LIB and AMIGA.LIB (the stubs to enable C to call
  45. Operating System code from libraries), which involved processing
  46. all the .fd files in the FD1.3 drawer using a set of GAWK scripts ..
  47. but that's another story.
  48.  
  49. The libraries are now in a stable and usable state, at any rate if your
  50. interests are like mine: porting utilities and general infrastructure
  51. software. (I realise this is somewhat incestuous! takes all sorts ..)
  52. The software ported so far includes GAWK, SED, OBJDUMP, NM, GCC, LD,
  53. AR, the MAKE from a middle-age Fish Disk, my own GREP, DIFF. Usually
  54. the problems arise from the software itself; the Free Software
  55. Foundation is on occasion very casual about the standard of software
  56. it produces from the maintainability viewpoint. A function prototype
  57. is a rare beast indeed. The source file for ld is more than 7000 lines,
  58. I intended to split it up but telling which bits went together had me
  59. beat.
  60.  
  61.  
  62.  
  63.  
  64.  
  65. Setup
  66. -----
  67.  
  68. The full distribution (to be available, I hope, on a PD disk near you
  69. soon) consists of:
  70.  
  71. bin9110a.lzh    the executables, to go in bin/
  72. lib9110b.lzh    the libraries/startup files, to go in lib/
  73. inc9110b.lzh    the includes, to go in include/ (I wish I could put
  74.                 in the Amiga headers for you, but they're (c) C= )
  75. doc9110b.lzh    such documentation as I have access to, not always
  76.                 in the most readable of forms (raw TEX), release
  77.                 history, and other notes.
  78.  
  79. I Assign the logical name GCC: to the location on my A590 where I
  80. keep GCC. The listing below is the script GCC:Startup that sets up
  81. the environment (in the doc archive):
  82.  
  83. -----------------------------------------------------XO
  84. ; GCC:Startup
  85. ; This is a script for setting up the GCC front end.
  86.  
  87. ; GCC:bin contains cc, cpp, cc1, gas, ld, ar, objdump, nm
  88. ; GCC:lib contains startups, libraries
  89. ; GCC:include contains system include files
  90.  
  91. Assign GCC: Applications:gcc        ; Applications: is a partition
  92.  
  93. ; The following sets up the standard include directories - amiga_include
  94. ; is *not* included in this distribution, because it is (c) C=.
  95. ; If you don't do this, cpp searches gnu_gxx_include:, gnu_cc_include:,
  96. ; and include: (and you'll get the odd requester for them).
  97.  
  98. SetEnv GCC_INCLUDES "-I gcc:include -I gcc:amiga_include"
  99.  
  100. ; *NOTE* Do not assign the temporary area (TMPDIR) to the ramdisc unless
  101. ; you've got at least 3Mb (otherwise you'll probably run out of memory)
  102.  
  103. SetEnv TMPDIR "T:"
  104.  
  105. ; final setup: add to path ..
  106.  
  107. Path GCC:bin add
  108.  
  109. ; alias gcc ..
  110.  
  111. Alias cc gcc
  112.  
  113. ; bump stack (GNU software is a bit stack-happy)
  114.  
  115. Stack 131072
  116.  
  117. ; ready to roll ..
  118. ------------------------------------------XO
  119.  
  120.  
  121.  
  122.  
  123.  
  124. First Steps
  125. -----------
  126.  
  127. The simplest use of GCC, , to compile `foo.c' and generate the
  128. executable file `foo', is
  129.  
  130.     > gcc foo.c
  131.  
  132. Beyond that, GCC has a fairly standard set of controlling options. The
  133. full set are in the file gcc.texinfo in the `doc' archive, but a
  134. useful subset is:
  135.  
  136. General:
  137. -------
  138.  
  139. -o file     output is file.
  140.  
  141. -v          be verbose.
  142.  
  143. Compilation:
  144. -----------
  145.  
  146. -c          compile only (default is to attempt to link as well).
  147.  
  148. -O          optimise.
  149.  
  150. -D def      define def.
  151.  
  152. -I loc      add loc to front of standard include locations
  153.             (see Startup above).
  154.  
  155. -Q          be unquiet (list functions as compiled).
  156.  
  157. Linking:
  158. -------
  159.  
  160. -l lib      add the library liblib.a to the input to ld at the
  161.             point in the sequence of object files implied by
  162.             its position in the sequence of source and object
  163.             files given.
  164.  
  165. -L loc      add loc to the standard library locations (just
  166.             gcc:lib at present).
  167.  
  168. -s          include symbols in the executable (not a lot of
  169.             use at the moment).
  170.  
  171. Changes from standard cc:
  172. ------------------------
  173.  
  174. o   Default output executable filename is the filename of
  175.     the first object file with all back to the first period
  176.     stripped (if no period, a.out).
  177.  
  178. o   -s is inverted as it's passed to ld, so you say -s to
  179.     request symbols rather than to strip them.
  180.  
  181.  
  182.  
  183.  
  184.  
  185. Finis
  186. -----
  187.  
  188. Best of luck to all of you!
  189.  
  190. Simon Wright, 5 October 1991
  191.  
  192. sjwright@cix.compulink.co.uk
  193. +44(0)329-280835
  194. 22 Somervell Drive
  195. Fareham
  196. PO16 7QG
  197. United Kingdom
  198.